package com.zbg;

import javax.servlet.RequestDispatcher;
import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;

@WebServlet(name = "ServletBase",urlPatterns = ("/ServletBase"))
public class ServletBase extends HttpServlet {
    @Override
    public void destroy() {
        System.out.println("ServletFor被销毁");
    }

    @Override
    public void init() throws ServletException {
        System.out.println("ServletFor创建");
    }
    protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {

    }

    protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
        System.out.println("经过后台forward");
        RequestDispatcher requestDispatcher = request.getRequestDispatcher("a/b/c/a.html");
        requestDispatcher.forward(request,response);

    }
}
